#include <iostream>
using namespace std;
using ll=long long;

int main() {
    ll a,h,b,k;
    cin>>a>>h>>b>>k;
    ll ret=0;
    while(h>0 && k>0)
    {
        ret+=a+b;
        ll t=a;
        h-=b;
        k-=a;
    }
    if(h>0)
    {
        ret+=a*10;
    }
    else if(k>0)
    {
        ret+=b*10;
    }
    cout<<ret<<endl;
    return 0;
}
